{\rtf1\mac\ansicpg10000\cocoartf102
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fnil\fcharset77 Monaco;
\f3\fnil\fcharset77 LucidaGrande;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue191;\red96\green96\blue96;
\red191\green0\blue0;\red0\green115\blue0;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural

\f0\b\fs36 \cf0 PV_Compander			simple spectral compression/expansion\

\f1\b0\fs24 \

\f0\b PV_Compander.ar(buffer,  thresh, slopeAbove, slopeBelow)\

\f1\b0 \
applies compression/expansion to individual magnitudes.\

\f0\b buffer
\f1\b0  - fft buffer A.\

\f0\b thresh - 
\f1\b0 mag thresh
\f0\b   \
slopeAbove, slopeBelow 
\f1\b0 - same as
\f0\b  Compander
\f1\b0 \
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural

\f2\fs18 \cf0 s.boot;\
\cf2 (\
b = \cf3 Buffer\cf2 .alloc(s, 2048, 1);\
c = \cf3 Buffer\cf2 .read(s, \cf4 "sounds/
\f3\fs24 a11wlk01.wav
\f2\fs18 "\cf2 );\
)\
\
\cf5 // mostly compress\cf2 \
(\
\cf3 SynthDef\cf2 (\cf4 "help-Compander"\cf2 , \{ \cf3 arg\cf2  out=0, bufnum=0, soundBufnum=2;\
	\cf3 var\cf2  in, chain;\
	in = \cf3 PlayBuf\cf2 .ar(1, soundBufnum, \cf3 BufRateScale\cf2 .kr(soundBufnum), loop: 1);\
	chain = \cf3 FFT\cf2 (bufnum, in);\
	chain = \cf3 PV_Compander\cf2 (chain, \cf3 MouseX\cf2 .kr(1, 50), 1.2, 0.25); \
	\cf3 Out\cf2 .ar(out,  \cf3 IFFT\cf2 (chain).dup);\
\}).play(s,[\cf6 \\out\cf2 , 0, \cf6 \\bufnum\cf2 , b.bufnum, \cf6 \\soundBufnum\cf2 , c.bufnum]);\
)	\
\
\cf5 // mostly expand\cf2 \
(\
\cf3 SynthDef\cf2 (\cf4 "help-Compander2"\cf2 , \{ \cf3 arg\cf2  out=0, bufnum=0, soundBufnum=2;\
	\cf3 var\cf2  in, chain;\
	in = \cf3 PlayBuf\cf2 .ar(1, soundBufnum, \cf3 BufRateScale\cf2 .kr(soundBufnum), loop: 1);\
	chain = \cf3 FFT\cf2 (bufnum, in);\
	chain = \cf3 PV_Compander\cf2 (chain, \cf3 MouseX\cf2 .kr(1, 50), 2.0, 0.85); \
	\cf3 Out\cf2 .ar(out, \cf3 IFFT\cf2 (chain).dup);\
\}).play(s,[\cf6 \\out\cf2 , 0, \cf6 \\bufnum\cf2 , b.bufnum, \cf6 \\soundBufnum\cf2 , c.bufnum]);\
)\
\
\cf5 // pv sustainer\cf2 \
(\
\cf3 SynthDef\cf2 (\cf4 "help-Compander3"\cf2 , \{ \cf3 arg\cf2  out=0, bufnum=0;\
	\cf3 var\cf2  trig, in, chain;\
	in =\cf3 Mix\cf2 .ar(\cf3 Ringz\cf2 .ar(\cf3 GaussTrig\cf2 .ar(7.3), [160, 180], 0.2)).softclip;\
	chain = \cf3 FFT\cf2 (bufnum, in);\
	chain = \cf3 PV_Compander\cf2 (chain, \cf3 MouseX\cf2 .kr(1, 80), 0.1, 1.0); \
	\cf3 Out\cf2 .ar(out, \cf3 Limiter\cf2 .ar(\cf3 IFFT\cf2 (chain), 0.999, 0.05).dup);\
\}).play(s,[\cf6 \\out\cf2 , 0, \cf6 \\bufnum\cf2 , b.bufnum]);\
)	\
\
(\
\cf3 SynthDef\cf2 (\cf4 "help-Compander3"\cf2 , \{ \cf3 arg\cf2  out=0, bufnum=0;\
	\cf3 var\cf2  trig, in, chain;\
	in=\cf3 LPF\cf2 .ar(\cf3 Mix\cf2 .ar(\cf3 CombL\cf2 .ar(\cf3 Decay\cf2 .ar(\cf3 Dust\cf2 .ar(0.5.dup(4)), 0.01, \cf3 WhiteNoise\cf2 .ar), 0.02, \cf3 Array\cf2 .rand(4, 0.005, 0.01), 0.2)), 1500);\
	chain = \cf3 FFT\cf2 (bufnum, in);\
	chain = \cf3 PV_Compander\cf2 (chain, \cf3 MouseX\cf2 .kr(1, 80), 0.1, 1.0); \
	\cf3 Out\cf2 .ar(out, \cf3 Limiter\cf2 .ar(\cf3 IFFT\cf2 (chain), 0.999, 0.05).dup);\
\}).play(s,[\cf6 \\out\cf2 , 0, \cf6 \\bufnum\cf2 , b.bufnum]);\
)		\
		\
\
}